package sy.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.GenericGenerator;

import com.fasterxml.jackson.annotation.JsonProperty;

@Entity
@Table(name = "app_repair", catalog = "ssh")
public class AppRepair implements java.io.Serializable{
	private Integer id;
	private String code;
	private AppEquipment equipmentId;
	private SysAccount sysAccountId;
	private String type;
	private String content;
	private String imgUrl;
	private Date time;
	private String status;
	private String remarks;
	
	@JsonProperty(value = "sysAccountName")
    private String sysAccountName;
	
	@JsonProperty(value = "appEquipmentName")
    private String appEquipmentName;
	
	@JsonProperty(value = "appEquipmentCode")
    private String appEquipmentCode;
	
	public AppRepair() {
		super();
	}

	@Id
	@GeneratedValue
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	@Column(name = "code")
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "equipmentId")
	public AppEquipment getEquipmentId() {
		return equipmentId;
	}

	public void setEquipmentId(AppEquipment equipmentId) {
		this.equipmentId = equipmentId;
	}
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "sysAccountId")
	public SysAccount getSysAccountId() {
		return sysAccountId;
	}

	public void setSysAccountId(SysAccount sysAccountId) {
		this.sysAccountId = sysAccountId;
	}
	@Column(name = "type")
	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}
	@Column(name = "content")
	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}
	@Column(name = "time")
	public Date getTime() {
		return time;
	}

	public void setTime(Date time) {
		this.time = time;
	}
	@Column(name = "status")
	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}
	@Column(name = "remarks")
	public String getRemarks() {
		return remarks;
	}

	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}
	@Column(name = "imgUrl")
	public String getImgUrl() {
		return imgUrl;
	}

	public void setImgUrl(String imgUrl) {
		this.imgUrl = imgUrl;
	}

	@Transient
	public String getSysAccountName() {
		return getSysAccountId().getName();
	}

	public void setSysAccountName(String sysAccountName) {
		this.sysAccountName = sysAccountName;
	}

	@Transient
	public String getAppEquipmentName() {
		return getEquipmentId().getName();
	}

	public void setAppEquipmentName(String appEquipmentName) {
		this.appEquipmentName = appEquipmentName;
	}

	@Transient
	public String getAppEquipmentCode() {
		return getEquipmentId().getCode();
	}

	public void setAppEquipmentCode(String appEquipmentCode) {
		this.appEquipmentCode = appEquipmentCode;
	}
	
	
	
}
